<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="<?=base_url()?>assets/default/js/jquery.locationpicker.js"></script>

<script type="text/javascript">
		$(function(){
			$('#location').locationPicker();
			
			$('#edit-btn').click(function() {
				if($("#edit-association-form").form('validate')) $('#edit-association-form').submit();
			});
			
			$('#creationdate').datebox({  
			    required:true,
			    formatter:function(date){
                        var y = date.getFullYear();
                        var m = date.getMonth()+1;
                        var d = date.getDate();
                        return y+'-'+m+'-'+d;
                }
			});  
		
			$('#edit-association-form').form({
				onSubmit: function(){  
			        return $("#edit-association-form").form('validate');  
			    },
				success:function(result){
					var result = eval('('+result+')');

					if (result.success){
						$.messager.show({
							title: 'Success',
							msg: result.msg
						});
					} else {
						$.messager.show({
							title: 'Error',
							msg: result.msg
						});
					}

				}
			});
		});
	</script>


<div class="easyui-layout" style="width:100%;height:1000px;">
	<div region="north" style="overflow:hidden;height:70px;pediting-left:25px;">
		<table align="left">
			<tr>
				<td>
					<img src="<?= base_url()?>assets/default/images/user/association.png"/>
				</td>
				<td valign="middle">
					<h1>edit Association</h1>
				</td>
			</tr>
		</table>
	</div>
	<div region="south" split="true" style="height:50px;background:#fafafa;">
	</div>
	<div region="east" icon="icon-reload" title="Notifications" split="true" style="width:250px;">
	</div>
	<div region="west" split="true" title="Navigation" style="width:200px;">
		<?= $navigation?>
	</div>
	<div region="center" title="User Profile" style="background:#fafafa;pediting:10px;">
		
		
		<div id="win" class="easyui-panel" title="Association Information" style="pediting:10px;">
			<form id="edit-association-form" action="<?= site_url("user/edit_association")?>" method="post">
			<table>
					<input type="hidden" name="id" type="text" value="<?= $associationData["id"]?>"/>
					<tr>
						<td width="150px">Raison social:</td>
						<td><input class="easyui-validatebox" size="40" name="raison_social" type="text" value="<?= $associationData["raison_social"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Email:</td>
						<td><input class="easyui-validatebox" size="40" name="mail" type="text" value="<?= $associationData["mail"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Fondateur:</td>
						<td><input class="easyui-validatebox" size="40" name="fondateur" type="text" value="<?= $associationData["fondateur"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Date:</td>
						<td><input id="creationdate" class="easyui-datebox" size="40" name="date_fondation" type="text" value="<?= $associationData["date_fondation"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Contact:</td>
						<td><input class="easyui-validatebox" size="40" name="contact" type="text" value="<?= $associationData["contact"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Telephone:</td>
						<td><input class="easyui-validatebox" size="40" name="telephone" type="text" value="<?= $associationData["telephone"]?>" required="true"/></td>
					</tr>
					<tr>
						<td>Adresse:</td>
						<td><textarea cols="40" class="easyui-validatebox" name="adresse" type="text" value="" required="true"><?= $associationData["adresse"]?></textarea></td>
					</tr>
					<tr>
						<td>Location:</td>
						<td><input id="location" name="location" type="text" value="<?= $associationData["location"]?>" /></td>
					</tr>
					<tr>
						<td>Description:</td>
						<td><textarea cols="40" class="easyui-validatebox" name="description" type="text" value=""><?= $associationData["description"]?></textarea></td>
					</tr>
					<tr>
						<td></td>
						<td align="right"><a href="#" class="easyui-linkbutton" iconCls="icon-ok" id="edit-btn" >Update Association</a></td>
					</tr>
				</table>
			</form>
		</div>				
	</div>
</div>



